Rust for Linux
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
Rust for Linux is an ongoing project started in 2020 to add Rust as a programming language that can be used within the Linux kernel software, which has been written using C and assembly only. This project aims to leverage Rust's memory safety to reduce bugs when writing kernel drivers.cite-ref-zdnet-going-next-1-0[1] Progress has been slower than hoped by both Rust advocates and Linus Torvalds, lead of the Linux kernel project.cite-ref-2[2] In December 2023, the first drivers written in Rust were accepted, and released in version 6.8.cite-ref-usenix-empirical-study-3-0[3]cite-ref-itsfoss-kernel-6-8-4-0[4]
Contents
• History
• Usage
• See also
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
History
The Linux kernel has been primarily written in C and assembly languages since its first release in 1991. Around 1997, the addition of C++ was considered and experimented upon for two weeks before being scrapped.cite-ref-5[5] Rust was created in 2006 and combines the performance of low-level programming languages (such as C) with a focus on memory safety and a user-friendly tool set and syntax.cite-ref-6[6]
An example Linux external loadable kernel module created using the Rust language was published by Taesoo Kim in 2013.cite-ref-7[7]cite-ref-8[8]
The Rust for Linux project was announced in 2020 in the Linux kernel mailing list with goal of adding Rust as a programming language that could be used within the Linux project.cite-ref-infoq2021-9-0[9] At the Open Source Summit 2022, Linus Torvalds stated that the incorporation of the project's work could begin as soon as the Linux 5.20 release, later named as Linux 6.0.cite-ref-10[10] The first release candidate for Linux 6.0 was created on 14 August 2022, without Rust support. In the release notes for Linux 6.0-rc1, Torvalds expressed his intention for adding Rust support, "I actually was hoping that we'd get some of the first rust infrastructure, and the multi-gen LRU VM, but neither of them happened this time around."cite-ref-11[11]cite-ref-12[12] On 19 September 2022, an article from ZDNet revealed an email from Linus Torvalds stating that "Unless something odd happens, it [Rust] will make it into 6.1".cite-ref-13[13]
In October 2022, a pull request for accepting the implementation for Rust for Linux was approved by Torvalds.cite-ref-14[14] As of Linux 6.1, support was intentionally left minimal in order to allow developers to test the feature.cite-ref-15[15]
Rust for Linux developers created a new library "pinned-init" to safely and fallibly initialize memory that must not be relocated.cite-ref-usenix-empirical-study-3-1[3] It was first included in Linux 6.4,cite-ref-16[16] and been improved in later versions.cite-ref-usenix-empirical-study-3-2[3]
Linux 6.10 included RISCV processor architecture support for Rust.cite-ref-heise-riscv-17-0[17]
In July 2024 a change was accepted into Linux to support multiple Rust versions for the first time, allowing compiling using both 1.78 (Released 2 May, 2024) and 1.79 (Released 13 June, 2024).cite-ref-heise-qr-18-0[18]
As of August 2024, Rust for Linux depends on unstable features of the Rust compiler.cite-ref-zdnet-going-next-1-1[1]
Usage
Linux kernel contains the following Rust components:
• rnull, a drop-in replacement for the null devicecite-ref-usenix-empirical-study-3-3[3]cite-ref-19[19]
Other notable projects using Rust in Linux include:
• NVM Express (NVMe) device drivercite-ref-usenix-empirical-study-3-6[3]
• Asahi Linux's Apple silicon AGX GPU DRM drivercite-ref-25[25]cite-ref-usenix-empirical-study-3-8[3]cite-ref-26[26]
• Nova, intended to create a Rust nouveau Nvidia GPU driver, is being developed on the freedesktop.org project infrastructurecite-ref-itsfoss-nova-28-0[28]cite-ref-29[29]
See also
References
cite-note-itsfoss-kernel-6-8-44. ↑ citerefdas2024Das, Ankush (11 March 2024). "Linux Kernel 6.8 Released! Goes Big On Hardware Support". news.itsfoss.com. Retrieved 4 September 2024.
cite-note-55. ↑ citerefclaburn2022Claburn, Thomas (2022-06-23). "Linus Torvalds says Rust is coming to the Linux kernel". The Register. Archived from the original on 2022-07-28. Retrieved 2022-07-25.
cite-note-77. ↑ citerefvaughan-nichols2022Vaughan-Nichols, Steven J. (5 October 2022). "Rust in the Linux Kernel". thenewstack.io. Retrieved 31 August 2024.
cite-note-88. ↑ citerefojeda2022Ojeda, Miguel (23 June 2022). "Memory Safety for the World's Largest Software Project". Retrieved 31 August 2024.
cite-note-infoq2021-99. ↑ citerefsimone2021Simone, Sergio De (2021-04-27). "Using Rust to Write Safe and Correct Linux Kernel Drivers". InfoQ. Archived from the original on 2022-09-22. Retrieved 2022-08-04.
cite-note-1313. ↑ citerefvaughan-nichols2022Vaughan-Nichols, Steven (2022-09-19). "Linus Torvalds: Rust will go into Linux 6.1". ZDNET. Archived from the original on 2023-01-19. Retrieved 2022-09-20.
cite-note-1414. ↑ citerefproven2022Proven, Liam (2022-10-05). "Linux 6.1: Rust to hit mainline kernel". The Register. Archived from the original on 2022-10-12. Retrieved 2022-10-12.
cite-note-1616. ↑ citereflarabelLarabel, Michael. "More Rust Code Readied For Linux 6.4". phoronix.com. Retrieved 31 August 2024.
cite-note-1919. ↑ citereflarabelLarabel, Michael. "Rust Null Block Driver Published To Begin Experimenting With Rust For Linux Storage". phoronix.com. Retrieved 31 August 2024.
cite-note-asix-2020. ↑ citereflarabelLarabel, Michael. "The First Rust-Written Network PHY Driver Set To Land In Linux 6.8". phoronix.com. Retrieved 31 August 2024.
cite-note-2121. ↑ "Rust abstractions for network PHY drivers". Retrieved 31 August 2024.
cite-note-2222. ↑ "Add a QR code panic screen". Retrieved 16 June 2025.
cite-note-phoronix-ext2-2323. ↑ citereflarabelLarabel, Michael. "Microsoft Engineer Ports EXT2 File-System Driver To Rust". phoronix.com. Retrieved 31 August 2024.
cite-note-2424. ↑ citereffilho2021Filho, Wedson Almeida (April 14, 2021). "Rust in the Linux kernel". Google Security Blog. Retrieved 31 August 2024.
cite-note-2626. ↑ citereflarabelLarabel, Michael. "Initial Rust DRM Abstractions, AGX Apple DRM Driver Posted For Review". phoronix.com. Retrieved 31 August 2024.
cite-note-2727. ↑ citereflarabelLarabel, Michael. "PuzzleFS Continues Striving To Be The Best File-System For Containers". phoronix.com. Retrieved 31 August 2024.
cite-note-itsfoss-nova-2828. ↑ citerefdas2024Das, Ankush (21 March 2024). "Red Hat Unveils a Rust-based 'Nova' Driver: A Better Nouveau for Nvidia GPUs". news.itsfoss.com. Retrieved 4 September 2024.
cite-note-2929. ↑ citereflarabelLarabel, Michael. "Red Hat's Long, Rust'ed Road Ahead For Nova As Nouveau Driver Successor". phoronix.com. Retrieved 31 August 2024.